﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DataManager.BLL;

namespace FILMEK.GUI
{
    public partial class frmMovies : Form
    {
        FilmManager manager;

        public frmMovies(FilmManager manager)
        {

            InitializeComponent();
            this.manager = manager;
        }

        private void FillDgvMovies(DataSet movieList)
        {
            dgvMovies.DataSource = movieList.Tables[0];
        }

        private void btnKeres_Click(object sender, EventArgs e)
        {
            string temp = cbFields.SelectedItem.ToString();
            if (temp == "Cím")
            {
                DataSet movieList = manager.getMovieListOnTitle(tbCondition.Text);
                FillDgvMovies(movieList);
            }
            else
                if (temp == "Megjelenési év")
                {
                    DataSet movieList = manager.getMovieListOnYear(Convert.ToInt32(tbCondition.Text));
                    FillDgvMovies(movieList);
                }
                else
                    if (temp == "Színész")
                    {
                        DataSet movieList = manager.getMovieListOnActor(tbCondition.Text);
                        FillDgvMovies(movieList);
                    }
                    else
                        if (temp == "Rendező")
                        {
                            DataSet movieList = manager.getMovieListOnDirector(tbCondition.Text);
                            FillDgvMovies(movieList);
                        }
        }
    }
}
